package com.atguigu.spzx.product.mapper;

import com.atguigu.spzx.product.entity.Category;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import java.util.List;

/**
 * <p>
 * 商品分类 Mapper 接口
 * </p>
 *
 * @author flyduck
 * @since 2023-11-04
 */
public interface CategoryMapper extends BaseMapper<Category> {

    /**
     * 根据parentId查询
     * @param parentId
     * @return
     */
    default List<Category> getCategoryListByParentId(Long parentId){
        QueryWrapper<Category> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("parent_id", parentId);
        return this.selectList(queryWrapper);
    }
}
